<template>
  <div class="badge">
    <fx-card title="基础用法">
      <fx-badge class="mr20" :model-value="3" type="primary">
        <fx-button>评论</fx-button>
      </fx-badge>
      <fx-badge class="mr20" :model-value="5" type="success">
        <fx-button>评论</fx-button>
      </fx-badge>
      <fx-badge class="mr20" :model-value="8" type="warning">
        <fx-button>评论</fx-button>
      </fx-badge>
      <fx-badge class="mr20" :model-value="10" type="error">
        <fx-button>评论</fx-button>
      </fx-badge>
      <template #hide>
        <pre v-highlight="base"><code></code></pre>
      </template>
    </fx-card>
    <fx-card title="最大值">
      <fx-row>
        <fx-col :span="3">
          <fx-badge class="mr20" :model-value="maxBadge" :max="99">
            <fx-button>评论</fx-button>
          </fx-badge>
        </fx-col>
        <fx-col :span="3">
          <fx-badge class="mr20" :model-value="maxBadge" :max="13">
            <fx-button>评论</fx-button>
          </fx-badge>
        </fx-col>
      </fx-row>
      <fx-input-number class="mt20" v-model="maxBadge" :min="0" :step="10"/>
      <template #hide>
        <pre v-highlight="max"><code></code></pre>
      </template>
    </fx-card>
    <fx-card title="自定义内容">
      <fx-badge class="mr20" model-value="new">
        <fx-button>评论</fx-button>
      </fx-badge>
      <fx-badge class="mr20" model-value="hot">
        <fx-button>评论</fx-button>
      </fx-badge>
      <template #hide>
        <pre v-highlight="text"><code></code></pre>
      </template>
    </fx-card>
    <fx-card title="点">
      <fx-badge class="mr20" is-dot type="primary">
        <fx-button type="primary">评论</fx-button>
      </fx-badge>
      <fx-badge class="mr20" is-dot type="success">
        <fx-button type="primary">评论</fx-button>
      </fx-badge>
      <fx-badge class="mr20" is-dot type="warning">
        <fx-button type="primary">评论</fx-button>
      </fx-badge>
      <fx-badge class="mr20" is-dot type="error">
        <fx-button type="primary">评论</fx-button>
      </fx-badge>
      <template #hide>
        <pre v-highlight="dot"><code></code></pre>
      </template>
    </fx-card>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'FBadge',
  setup () {
    const maxBadge = ref<number>(10)

    const base = `<fx-badge class="mr20" :model-value="3" type="primary">
<fx-button>评论</fx-button>
</fx-badge>
<fx-badge class="mr20" :model-value="5" type="success">
  <fx-button>评论</fx-button>
</fx-badge>
<fx-badge class="mr20" :model-value="8" type="warning">
  <fx-button>评论</fx-button>
</fx-badge>
<fx-badge class="mr20" :model-value="10" type="error">
  <fx-button>评论</fx-button>
</fx-badge>`

    const max = `<fx-badge class="mr20" :model-value="100" :max="99">
  <fx-button>评论</fx-button>
</fx-badge>
<fx-badge class="mr20" :model-value="100"  :max="13">
  <fx-button>评论</fx-button>
</fx-badge>`

    const text = `<fx-badge class="mr20" model-value="new">
  <fx-button>评论</fx-button>
</fx-badge>
<fx-badge class="mr20" model-value="hot">
  <fx-button>评论</fx-button>
</fx-badge>`

    const dot = `<fx-badge class="mr20" is-dot type="primary">
  <fx-button type="primary">评论</fx-button>
</fx-badge>
<fx-badge class="mr20" is-dot type="success">
  <fx-button type="primary">评论</fx-button>
</fx-badge>
<fx-badge class="mr20" is-dot type="warning">
  <fx-button type="primary">评论</fx-button>
</fx-badge>
<fx-badge class="mr20" is-dot type="error">
  <fx-button type="primary">评论</fx-button>
</fx-badge>`

    return {
      maxBadge,
      base,
      max,
      text,
      dot
    }
  }
})
</script>

<style scoped lang="scss">
.badge {
}
</style>
